﻿using Application.Dto;
using Application.IAppSrevices;
using AutoMapper;
using Domain.Entitys;
using Domain.Repositorys;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Application.AppSrevices
{
    public class CMKService : ICMKService
    {
        private readonly IMapper mapper;
        private readonly ICMKRepositoy cMKRepositoy;
        private readonly ICMRepositoy cMRepositoy;

        public CMKService(IMapper mapper,ICMKRepositoy cMKRepositoy,ICMRepositoy cMRepositoy)
        {
            this.mapper = mapper;
            this.cMKRepositoy = cMKRepositoy;
            this.cMRepositoy = cMRepositoy;
        }

        public async Task<int> CMKAddAsync(CMKAddDto cMKAddDto)
        {
            CMK cmk = mapper.Map<CMK>(cMKAddDto);
            return await cMKRepositoy.CMKAddAsync(cmk);
        }

        public async Task<int> CMKDeleteAsync(int id)
        {
            return await cMKRepositoy.CMKDeleteAsync(id);
        }
        public async Task<List<CMK>> CMKSelect(int pageIndex, int pageSize)
        {
            return await cMKRepositoy.CMKSelect(pageIndex, pageSize);
        }

        public int CMKSelectCount()
        {
            return cMKRepositoy.CMKSelectCount();
        }

        public async Task<List<CMK>> CMKSelectMax()
        {
            return await cMKRepositoy.CMKSelectMax();
        }
    }
}
